import React, { useState } from "react";
import router from "./router";
import { RouterProvider } from "react-router-dom";
import { Button, ConfigProvider, Input, Space, theme as antdTheme } from "antd";
function App() {
  const [thy, setThy] = useState("light");
  return (
    <div>
      <ConfigProvider
        theme={{
          // 1. 单独使用暗色算法
          algorithm:
            thy === "dark"
              ? antdTheme.darkAlgorithm
              : antdTheme.defaultAlgorithm,

          // 2. 组合使用暗色算法与紧凑算法
          // algorithm: [theme.darkAlgorithm, theme.compactAlgorithm],
        }}
      >
        <Button
          type="primary"
          style={{ marginBottom: 16 }}
          onClick={() => {
            setThy(thy === "dark" ? "light" : "dark");
          }}
        >
          切换主题颜色(白天变黑夜)
        </Button>
        <RouterProvider router={router}></RouterProvider>
      </ConfigProvider>
    </div>
  );
}

export default App;
